package com.cade.agriculturemall.utils;

import android.content.res.Resources;
import android.support.annotation.NonNull;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created by Lobby on 2017/11/24.
 */

public class AssetsUtil {
    public static String stringFromAssetsName(@NonNull Resources resources, String name) {
        try {
            InputStreamReader inputReader = new InputStreamReader(resources.getAssets().open(name));
            BufferedReader bufReader = new BufferedReader(inputReader);
            String line = "";
            String Result = "";
            while ((line = bufReader.readLine()) != null)
                Result += line;
            return Result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
}
